<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="/layui/css/layui.css"media="all">
</head>
<body>
<table class="layui-table">
  <colgroup>
    <col width="150">
    <col width="200">
    <col>
  </colgroup>
  <thead>
    <tr>
      <th>服务类型</th>	
      <th>内网IP</th>
      <th>区服</th>
      <td>机器名</td>
      <td>环境</td>
      <th>代码版本</th>
      <th>数据版本</th>
      <th>时区</th>
      <th>CPU核数</th> 
      <th>内存</th>
      <th>负载(1-5-15)</th>
      <th>端口(内/外)</th> 
    </tr> 
  </thead>
  <tbody>
  <% let timezone_record=-1;let code_record=-1;let data_record=-1;%>
  <% let timezone_diff=false;let code_diff=false;let data_diff=false;%>
  <% ret.sort((a,b)=>{return a.sid[0]-b.sid[0]}) %>
  <% for(let i=0;i<ret.length;++i) {%>
  <tr>
  <% let _ts=ret[i].ts.map(x=>{if(x==1){return '游戏'}else if(x==9){return '平台'}else if(x==3){return '战斗'}}) %>
  <td><%=_ts%></td>
  <td><%=ret[i].ip%></td>
  <td><%=ret[i].sid%></td>
  <% if(ret[i].sinfo){%>
  <td><%=ret[i].sinfo.mname%></td>
  <td><%=ret[i].sinfo.env%></td>
  <% if (ret[i].ts==9){%>
        <td><%=ret[i].sinfo.code_ver%></td>
  <%}else{%>
        <% if(code_record==-1){ code_record=ret[i].sinfo.code_ver}%>
        <% if(code_record==ret[i].sinfo.code_ver){%>
        <td><%=ret[i].sinfo.code_ver%></td>
        <%}else{%>
        <% code_diff=true;%>
         <td><font color='red'><%=ret[i].sinfo.code_ver%></font></td>
        <%}%>
  <%}%>


  <% if (ret[i].ts==9){%>
        <td><%=ret[i].sinfo.data_ver%></td>
  <%}else{%>
        <% if(data_record==-1){ data_record=ret[i].sinfo.data_ver}%>
        <% if(data_record==ret[i].sinfo.data_ver){%>
        <td><%=ret[i].sinfo.data_ver%></td>
        <%}else{%>
          <% data_diff=true;%>
         <td><font color='red'><%=ret[i].sinfo.data_ver%></font></td>
        <%}%>
   <%}%>



  <% if(timezone_record==-1){ timezone_record=ret[i].sinfo.time_zone}%>
  <% if(timezone_record==ret[i].sinfo.time_zone){%>
  <td><%=ret[i].sinfo.time_zone%></td>
  <%}else{%>
   <% timezone_diff=true;%>
   <td><font color='red'><%=ret[i].sinfo.time_zone%></font></td>
  <%}%>

  <% let cpuinfo=`${ret[i].sinfo.cpu.length}` %>
  <td><%=cpuinfo%></td>
  <td><%=(ret[i].sinfo.mem/1073741824).toFixed(1)%>G</td>
  <%}else{%>
  <td>?</td>
  <td>?</td>
  <td>?</td>
  <td>?</td>
  <td>?</td>
  <td>?</td>
  <td>?</td>
  <%}%>


  <% let _arg_info=''%>
  <% let _bad=false %>
  <% for(let j=0;j<3;++j){%>
    <% let _arg=ret[i].avg[j].toFixed(1)%>
    <%if(_arg>=3){_bad=true;}%>
    <% _arg_info+=_arg%>
    <%if(j<2){_arg_info+='-'}%>
  <%}%>
  <% if(_bad){%>
  <td><font color='red'><%=_arg_info%></font></td>
  <%}else{%>
  <td><font color='green'><%=_arg_info%></font></td>
  <%}%>
  <td><%=ret[i].local%>/<%=ret[i].remote%></td>

<!--   <td><%=ret[i].avg[0].toFixed(2)%></td>
  <td><%=ret[i].avg[1].toFixed(2)%></td>
  <td><%=ret[i].avg[2].toFixed(2)%></td> -->
<!--   <% let _arg=((ret[i].avg.reduce((x,y)=>{return x+y}))/ret[i].avg.length).toFixed(2)%>
  <% let _tail='优秀';%>
  <% if(_arg>=5){_tail='糟糕'}else if(_arg>=3){_tail='吃紧'}else if(_arg>=1){_tail='良好'}%>
  <% if(_arg>=3){%>
  <td><font color='red'><%=_arg%>  (<%=_tail%>)</font></td>
  <%}else{%>
   <td><font color='green'><%=_arg%>  (<%=_tail%>)</font></td>
  <%}%> -->

  </tr>
  <%}%>
  </tbody>
</table>


分析报告<br>
<% if(timezone_diff){%>
<font color='red'>时区不统一！！！请确认</font>
<br>
<%}%>

<% if(code_diff){%>
<font color='red'>代码版本不统一，请确认（后台排除）</font>
<br>
<%}%>

<% if(data_diff){%>
<font color='red'>数据不统一，请确认（后台没有数据）</font>
<br>
<%}%>




</body>
</html>